// This is a part of the WceUi library.
// Copyright (C) WceUi Team
// All rights reserved.
//
// Coded by Hui Xu
//
#include "StdAfx.h"
#include "WceUiStatic.h"

CWceUiStatic::CWceUiStatic()
{
	m_bLMouseDown = FALSE;
	m_HandleDbClick.Init(this);
}

CWceUiStatic::~CWceUiStatic()
{
	
}


void CWceUiStatic::OnLButtonDown(UINT nFlags,  POINT point)
{
	UNREFERENCED_PARAMETER(nFlags);
	UNREFERENCED_PARAMETER(point);

	m_bLMouseDown = TRUE;

	if (!m_HandleDbClick.IsDbClick(nFlags, point))
	{
		GetCmdReceiver()->OnLMouseDown(this, nFlags, point);
	}


}

void CWceUiStatic::OnLButtonUp(UINT nFlags,	 POINT point)
{
	UNREFERENCED_PARAMETER(nFlags);
	UNREFERENCED_PARAMETER(point);
	if (m_bLMouseDown)
	{
		m_bLMouseDown = FALSE;
	}
	m_HandleDbClick.RecordLButtonUp(nFlags, point);
	GetCmdReceiver()->OnLMouseUp(this, nFlags, point);
}

void CWceUiStatic::OnMouseMove(UINT nFlags, POINT point)
{
	GetCmdReceiver()->OnLMouseMove(this, nFlags, point);
}

void CWceUiStatic::OnLButtonDblClk(UINT nFlags, POINT point)
{
	UNREFERENCED_PARAMETER(nFlags);
	UNREFERENCED_PARAMETER(point);

	ASSERT(m_bLMouseDown);
	GetCmdReceiver()->OnLMouseDbClick(this, nFlags, point);
}


void CWceUiStatic::SetDbClick(DWORD dwDelay /* = DBCLICK_DEFALUT_DELAY */, 
							  int xDist /* = DBCLICK_DEFALUT_X_DIST */, 
							  int yDist /* = DBCLICK_DEFALUT_Y_DIST */)
{
	m_HandleDbClick.Init(this, dwDelay, xDist, yDist);
}